﻿<UserControl x:Class="TeamProjectManager.Shell.Modules.TeamProjects.TeamProjectsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border Grid.Row="0" BorderBrush="{StaticResource AccentBrush}" BorderThickness="0,0,0,1" Margin="0,0,0,5">
            <TextBlock Text="team projects" FontWeight="DemiBold" FontSize="14" Margin="0,5,0,5" />
        </Border>

        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <ComboBox Grid.Column="0" ItemsSource="{Binding Path=TeamProjectCollections}" SelectedItem="{Binding Path=SelectedTeamProjectCollection, Mode=TwoWay}" IsEnabled="{Binding Path=IsTeamProjectsLoadComplete}" />
            <TextBlock Grid.Column="1" Margin="5,0,0,0"><Hyperlink Command="{Binding Path=AddTeamProjectCollectionCommand}" ToolTip="Connect to a Team Project Collection">add</Hyperlink></TextBlock>
        </Grid>

        <TextBlock Grid.Row="2" Text="{Binding Path=InfoMessage, Converter={StaticResource caseConverter}}" ToolTip="{Binding Path=InfoMessageToolTip}" Foreground="{StaticResource UserMessageFontBrush}" TextWrapping="Wrap" Margin="0,5,0,0" />

        <Grid Grid.Row="3" Visibility="{Binding Path=TeamProjectsVisibility}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <WrapPanel Grid.Row="0">
                <TextBlock Margin="0,0,5,0"><Hyperlink Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=SelectAllCommand}">select all</Hyperlink></TextBlock>
                <TextBlock Margin="0,0,5,0"><Hyperlink Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=SelectNoneCommand}">select none</Hyperlink></TextBlock>
                <TextBlock Margin="0,0,5,0"><Hyperlink Command="{Binding Path=RefreshTeamProjectsCommand}" ToolTip="Refresh the list of Team Projects">refresh</Hyperlink></TextBlock>
                <TextBlock Margin="0,0,5,0"><Hyperlink Command="{Binding Path=ShowAllTeamProjectsCommand}" ToolTip="Show all Team Projects">show all</Hyperlink></TextBlock>
                <TextBlock><Hyperlink Command="{Binding Path=ShowOnlySelectedTeamProjectsCommand}" ToolTip="Show only the selected Team Projects">show selected</Hyperlink></TextBlock>
            </WrapPanel>

            <ListBox Grid.Row="1" Style="{StaticResource CheckedListBoxStyle}" ItemsSource="{Binding Path=AvailableTeamProjects}" x:Name="teamProjectsListBox" SelectionMode="Extended" SelectionChanged="teamProjectsListBox_SelectionChanged" Margin="0,5,0,0" HorizontalContentAlignment="Stretch" />
        </Grid>

    </Grid>
</UserControl>
